package com.sprouting.personal.service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sprouting.personal.dao.WordDao;
import com.sprouting.personal.model.entity.Word;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 单词
 *
 * @author ：LX（长沙麓谷）
 * @date 创建时间： 2023/1/3 11:28
 */
@Service
@Slf4j
public class WordService extends ServiceImpl<WordDao, Word> {

    @Resource
    private WordDao wordDao;

    /**
     * 根据单词组ID获取一条单词信息
     * @param wordGroupId 单词组ID
     * @return
     */
    public Word getWordByWordGroupIdTop1(String wordGroupId) {
        return wordDao.getWordByWordGroupIdTop1(wordGroupId);
    }

    /**
     * 根据单词查询
     * @param id 传则忽略查询该ID
     * @param userId 登录用户ID
     * @param wordGroupId 单词组ID
     * @param word 单词
     * @return
     */
    public Word getWordByWord(String id, String wordGroupId, String userId, String word) {
        return wordDao.getWordByWord(id, wordGroupId, userId, word);
    }

    /**
     * 根据单词组ID查询单词
     * @param wordGroupId 单词组ID
     * @return
     */
    public List<Word> getWordByWordGroupId(String wordGroupId) {
        return wordDao.getWordByWordGroupId(wordGroupId);
    }
}
